// 文章模块 目前先存储一下文章分类
import { reqGetArtCateList } from '@/api/artCate'
import { Message } from 'element-ui'
export default {
  state: {
    cateList: [] // 文章分类
  },
  mutations: {
    setCateList (state, arr) {
      state.cateList = arr
    }
  },
  actions: {
    async getCateList (context) {
      try {
        const { data } = await reqGetArtCateList()
        // console.log(data)
        // 提交mutation,让mutation修改cateList
        context.commit('setCateList', data.data)
      } catch (error) {
        Message.error('获取文章分类列表失败')
      }
    }
  },
  getters: {},
  namespaced: true // 开启命名空间
}
